//
//  EFSAppInfo.m
//  EFSMobile
//
//  Created by Chuan on 11/17/15.
//  Copyright © 2015 Elephants Financial Service. All rights reserved.
//

#import "YSAppInfo.h"

@implementation YSAppInfo

+ (NSString *)appID
{
    return [[NSBundle mainBundle] infoDictionary][@"YSAppID"];
}

+ (NSString *)appName
{
    return [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleDisplayName"];
}

+ (NSString *)appIcon
{
    return [[[NSBundle mainBundle] infoDictionary][@"CFBundleIconFiles"] objectAtIndex:0];
}

+ (NSURL *)appstoreURL
{
    NSString *appstore = @"itms-apps://itunes.apple.com/app/id";
    NSString *appId = [self appID];
    NSString *url = [NSString stringWithFormat:@"%@%@", appstore, appId];
    return [NSURL URLWithString:url];
}

+ (NSString *)appVersion
{
    return [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleShortVersionString"];
}

+ (NSString *)deviceUUID
{
    return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
}

+ (NSString *)marketId
{
    return [[NSBundle mainBundle] infoDictionary][@"YSChannelId"];
}

+ (NSString *)bundleId {
    return [[NSBundle mainBundle] infoDictionary][@"CFBundleIdentifier"];
}

+ (NSString *)appNameFromBundleId{
    NSString *bundleId = [[NSBundle mainBundle] infoDictionary][@"CFBundleIdentifier"];
    NSArray *tempArr = [bundleId componentsSeparatedByString:@"."];
    if ([tempArr count] > 0) {
        return [tempArr lastObject];
    }
    return @"";
}
@end
